@extends('admin.base')
@section('title','资产管理')
@section('header','资产')
@section('content')
    <fieldset class="layui-elem-field">
        <div class="layui-field-box">
            <a class="layui-btn-sm" href="{{url('admin/home')}}">首页</a>&raquo;
            <span class="layui-btn-sm">资产调整</span>
        </div>
    </fieldset>
    <form class="layui-form" method="post" action="" style="margin-top:30px">
        @csrf
        <div class="layui-form-item">
            <label class="layui-form-label">类型</label>
            <div class="layui-inline sousuo" style="margin-left:30px">
                <select name="type" lay-verify="required" id="type" style="display: none">
                    <option value="1">现金</option>
                    <option value="2">货款</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">符号</label>
            <div class="layui-inline sousuo" style="margin-left:30px">
                <select name="sign" lay-verify="required" id="sign" style="display: none">
                    <option value="1">+</option>
                    <option value="2">-</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item ">
            <label class="layui-form-label">账户:</label>
            <div class="layui-input-block" >
                <input type="text" name="username" required  lay-verify="required" placeholder="请输入账户" value="" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item ">
            <label class="layui-form-label">数量:</label>
            <div class="layui-input-block">
                <input type="text" name="num" min="0.00000001" step="0.00000001" required  lay-verify="required" placeholder="请输入数量" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
    <div class="layui-card-body">
        <p style="float: left; margin-bottom: 5px">
            {{--<a href="/ot_admin/user/add_user/"  class="layui-btn layui-btn-normal layui-btn-xs">添加用户</a>--}}
            {{--<a href="/ot_admin/banner/index?type=3" class="layui-btn layui-btn-normal layui-btn-xs">帮助中心</a>--}}
        </p>
        <p style="float: right;">
            {{--<a href="/ot_admin/us/create?type=1" class="layui-btn layui-btn-success layui-btn-xs">添加公告</a>--}}
            {{--<a href="/ot_admin/us/create?type=3" class="layui-btn layui-btn-success layui-btn-xs">添加帮助</a>--}}
            {{--<a href="#" onclick="app_refresh()" class="layui-btn layui-btn-success layui-btn-xs">刷新</a>--}}
            {{--<a href="#" onclick="app_back()" class="layui-btn layui-btn-success layui-btn-xs">返回</a>--}}

        </p>
        <form method="get">
            <div class="layui-card-header ">
                <div class="layui-form " style="display: flex;">
                    <p class="">昵称：</p>
                    <!--选择框-->
                    <!--搜索框-->
                    <div class="layui-inline sousuo">
                        <div class="layui-input-inline">
                            <input type="text" name="keywords" class="layui-input" id="" placeholder="请输入账户昵称"
                                   value="{{$request->keywords}}">
                        </div>
                    </div>
                    <button type="submit" class="layui-btn ok" style="margin-left:10px">确定</button>
                </div>
            </div>
        </form>
        <table class="layui-table " lay-even="" lay-size="sm">
            <thead>
            <tr>
                <th>昵称</th>
                <th>币种</th>
                <th>数量</th>
                <th>变更前余额</th>
                <th>变更后数量</th>
                <th>说明</th>
                <th>创建时间</th>
            </tr>
            </thead>
            <tbody>
            @forelse($wallet_log as $user)
                <tr>
                    <td>{{$user->username}}</td>
                    <td>{{$user->typename}}</td>

                    <td>{{$user->sign}}{{$user->num}}</td>
                    <td>{{$user->befor}}</td>
                    <td>{{$user->after}}</td>
                    <td>{{$user->msg}}</td>
                    <td>{{$user->created_at}}</td>
                </tr>
            @empty
                <tr><td colspan="21" style="text-align:center">暂无内容</td></tr>
            @endforelse
            </tbody>
        </table>
        {{$wallet_log->appends(['keywords'=>$request->keywords])->links()}}
    </div>

@section('js')
    <script type="text/javascript">
        //Demo
        layui.use('form', function(){

            var form = layui.form;
            form.render();
            //监听提交
            form.on('submit(formDemo)', function(data){
                ajax("{{url('admin/user/account_update')}}",data.field,function(data){
                    layer.close();
                    layer.closeAll();
                    layer.msg(data.msg);
                    if(data.code == 1){
                        location.href = location.href;
                    }
                });
                return false;
            });
        });
    </script>
@endsection


